WT_DECLARE_WT_MEMBER(1,JavaScriptConstructor,"WTableView",function(p,g,d,l,r,F){function G(b){return O?f.isGecko?-b.scrollLeft:b.scrollWidth-b.clientWidth-b.scrollLeft:b.scrollLeft}function P(b){return $(b.el).hasClass(F)}function w(b){var a=-1,c=-1,e=false,k=false,h=null;for(b=f.target(b);b;){var i=$(b);if(i.hasClass("Wt-tv-contents"))break;else if(i.hasClass("Wt-tv-c")){if(b.getAttribute("drop")==="true")k=true;if(i.hasClass(F))e=true;h=b;b=b.parentNode;a=b.className.split(" ")[0].substring(7)*
1;c=i.index();break}b=b.parentNode}return{columnId:a,rowIdx:c,selected:e,drop:k,el:h}}function H(){return f.pxself(d.firstChild,"lineHeight")}function y(b){var a,c,e=b.parentNode.childNodes;a=0;for(c=e.length;a<c;++a)if(e[a]==b)return a;return-1}function Q(b,a){var c=$(document.body).hasClass("Wt-rtl");if(c)a=-a;var e=b.className.split(" ")[0],k=e.substring(7)*1,h=b.parentNode,i=h.parentNode!==l,j=i?r.firstChild:d.firstChild,m=j.firstChild;e=$(j).find("."+e).get(0);var n=b.nextSibling,o=e.nextSibling,
u=f.pxself(b,"width")-1+a,x=f.pxself(h,"width")+a+"px";h.style.width=j.style.width=m.style.width=x;if(i){r.style.width=x;r.firstChild.style.width=x;d.style.left=x;l.style.left=x}b.style.width=u+1+"px";e.style.width=u+7+"px";for(p.layouts2.adjust(g.childNodes[0].id,[[1,1]]);n;n=n.nextSibling)if(o){if(c)o.style.right=f.pxself(o,"right")+a+"px";else o.style.left=f.pxself(o,"left")+a+"px";o=o.nextSibling}p.emit(g,"columnResized",k,parseInt(u));I.autoJavaScript()}function J(b,a){p.emit(g,{name:"itemTouchEvent",
eventObject:b,event:a})}jQuery.data(g,"obj",this);var I=this,f=p.WT,O=$(document.body).hasClass("Wt-rtl"),z=0,A=0,B=0,C=0,D=false,v=0,q=0,K=0,M=0;l.onscroll=function(){d.scrollLeft=l.scrollLeft;I.onContentsContainerScroll()};this.onContentsContainerScroll=function(){q=l.scrollLeft=d.scrollLeft;v=r.scrollTop=d.scrollTop;if(!(d.scrollTop==0&&f.isAndroid))if(d.clientWidth&&d.clientHeight&&!D&&(d.scrollTop<B||d.scrollTop>C||d.scrollLeft<z||d.scrollLeft>A))p.emit(g,"scrolled",Math.round(G(d)),Math.round(d.scrollTop),
Math.round(d.clientWidth),Math.round(d.clientHeight))};d.wtResize=function(b,a,c){if(a-K>(A-z)/2||c-M>(C-B)/2){K=a;M=c;a=b.clientHeight==b.firstChild.clientHeight?-1:b.clientHeight;p.emit(g,"scrolled",Math.round(G(b)),Math.round(b.scrollTop),Math.round(b.clientWidth),Math.round(a))}};var N=null;this.mouseDown=function(b,a){f.capture(null);var c=w(a);if(!a.ctrlKey&&!a.shiftKey){var e={ctrlKey:a.ctrlKey,shiftKey:a.shiftKey,target:a.target,srcElement:a.srcElement,type:a.type,which:a.which,touches:a.touches,
changedTouches:a.changedTouches,pageX:a.pageX,pageY:a.pageY,clientX:a.clientX,clientY:a.clientY};N=setTimeout(function(){g.getAttribute("drag")==="true"&&P(c)&&p._p_.dragStart(g,e)},400)}};this.mouseUp=function(){clearTimeout(N)};this.resizeHandleMDown=function(b,a){var c=b.parentNode,e=-(f.pxself(c,"width")-1),k=1E4;if($(document.body).hasClass("Wt-rtl")){var h=e;e=-k;k=-h}new f.SizeHandle(f,"h",b.offsetWidth,g.offsetHeight,e,k,"Wt-hsh2",function(i){Q(c,i)},b,g,a,-2,-1)};var s,E=0;this.touchStart=
function(b,a){w(a);if(a.touches.length>1){clearTimeout(s);s=setTimeout(function(){J(b,a)},1E3);E=a.touches.length}else{clearTimeout(s);s=setTimeout(function(){J(b,a)},50);E=1}};this.touchMove=function(b,a){a.touches.length==1&&s&&clearTimeout(s)};this.touchEnd=function(){s&&E!=1&&clearTimeout(s)};this.scrolled=function(b,a,c,e){z=b;A=a;B=c;C=e};this.resetScroll=function(){l.scrollLeft=q;d.scrollLeft=q;d.scrollTop=v;r.scrollTop=v};this.setScrollToPending=function(){D=true};this.scrollToPx=function(b,
a){v=a;q=b;this.resetScroll()};this.scrollTo=function(b,a,c){D=false;if(a!=-1){b=d.scrollTop;var e=d.clientHeight;if(c==0)if(b+e<a)c=1;else if(a<b)c=2;switch(c){case 1:d.scrollTop=a;break;case 2:d.scrollTop=a-(e-H());break;case 3:d.scrollTop=a-(e-H())/2;break}d.onscroll()}};var t=null;g.handleDragDrop=function(b,a,c,e,k){if(t){t.className=t.classNameOrig;t=null}if(b!="end"){var h=w(c);if(!h.selected&&h.drop)if(b=="drop")p.emit(g,{name:"dropEvent",eventObject:a,event:c},h.rowIdx,h.columnId,e,k);else{a.className=
"Wt-valid-drop";t=h.el;t.classNameOrig=t.className;t.className+=" Wt-drop-site"}else a.className=""}};this.onkeydown=function(b){var a=b||window.event;if(a.keyCode==9){f.cancelEvent(a);var c=w(a);if(c.el){b=c.el.parentNode;c=y(c.el);var e=y(b),k=b.parentNode.childNodes.length,h=b.childNodes.length;a=a.shiftKey;for(var i=false,j=c,m;;){for(;a?j>=0:j<h;j=a?j-1:j+1)for(m=j==c&&!i?a?e-1:e+1:a?k-1:0;a?m>=0:m<k;m=a?m-1:m+1){if(j==c&&m==e)return;b=b.parentNode.childNodes[m];var n=$(b.childNodes[j]).find(":input");
if(n.size()>0){setTimeout(function(){n.focus();n.select()},0);return}}j=a?h-1:0;i=true}}}else if(a.keyCode>=37&&a.keyCode<=40){i=f.target(a);function o(u){return f.hasTag(u,"INPUT")&&u.type=="text"||f.hasTag(u,"TEXTAREA")}if(!f.hasTag(i,"SELECT")){c=w(a);if(c.el){b=c.el.parentNode;c=y(c.el);e=y(b);k=b.parentNode.childNodes.length;h=b.childNodes.length;switch(a.keyCode){case 39:if(o(i)){j=f.getSelectionRange(i);if(j.start!=i.value.length)return}e++;break;case 38:c--;break;case 37:if(o(i)){j=f.getSelectionRange(i);
if(j.start!=0)return}e--;break;case 40:c++;break;default:return}f.cancelEvent(a);if(c>-1&&c<h&&e>-1&&e<k){b=b.parentNode.childNodes[e];n=$(b.childNodes[c]).find(":input");n.size()>0&&setTimeout(function(){n.focus()},0)}}}}};this.autoJavaScript=function(){if(g.parentNode==null){g=d=l=null;this.autoJavaScript=function(){}}else if(!f.isHidden(g)){if(!f.isIE&&(v!=d.scrollTop||q!=d.scrollLeft)){if(typeof q==="undefined")if(a&&f.isGecko)l.scrollLeft=d.scrollLeft=q=0;else q=d.scrollLeft;else l.scrollLeft=
d.scrollLeft=q;r.scrollTop=d.scrollTop=v}a=g.offsetWidth-f.px(g,"borderLeftWidth")-f.px(g,"borderRightWidth");var b=d.offsetWidth-d.clientWidth;a-=r.clientWidth;if(a>200&&a!=d.tw){d.tw=a;d.style.width=a+"px";l.style.width=a-b+"px"}var a=$(document.body).hasClass("Wt-rtl");if(a)l.style.marginLeft=b+"px";else l.style.marginRight=b+"px";b=d.offsetHeight-d.clientHeight;if((a=r.style)&&a.marginBottom!==b+"px"){a.marginBottom=b+"px";p.layouts2.adjust(g.childNodes[0].id,[[1,0]])}}}});
